<?php 
session_start();
include("db_connect.php")
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Admin Panel</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="Basciautosales store the place where you can buy trade set build your own dream cars at its your ways" />
<meta name="description" content="Basciautosales store the place where you can buy trade set build your own dream cars at its your ways" />

<?php include("include/jquery.php");?>

<style>
#login{
width:600px;
height:300px;
background-color:white;
margin-left:auto;
margin-right:auto;
margin-top:200px;
border:2px solid;
border-radius:25px;
-moz-border-radius:25px; /* Old Firefox */
background: white url(images/logo.png) no-repeat bottom left; 
}

#potangina{
font-size:33px;
margin-left:10px;
font-family:"Times New Roman", Times, serif;
color:black;
}

#gago{
font-size:35px;
height:50px;
color:Black;
}

#place{
margin-top:60px;
margin-right:auto;
margin-left:auto;
}

.inputtype{
height:30px;
width:200px;
border:2px solid;
border-radius:10px;
-moz-border-radius:10px; /* Old Firefox */
}

#enter:hover{
background-color:lightgreen;
}
#enter{
float:right;
width:120px;
height:30px;
right:30px;
background-color:lightblue;
border:2px solid;
border-radius:25px;
-moz-border-radius:25px; /* Old Firefox */
}

</style>
<script>
$(document).ready(function() {
$("#enter").click(function() {
		enterme();
	});
});

function enterme(){
			var uname = $("#username");
			var _pass = $("#password");
			
			if($("#uname").val() == "" || $("#uname").val() == " " ){
				alert("Enter your uname");
			}
			else if($("#_pass").val() == "" || $("#_pass").val() == " "  ){
				alert("Enter your password");
				
			}
			else{
				$.ajax ({
					url: "scripts/checker.php?uname="+uname.val() + "&pass="+_pass.val(),
					success: function(data){
					var split = data.split("+");
					//alert(split[1] + split[2]);
					
					
						if(split[0] == "1"){
											
							if(split[1] == 1){
							
								window.location.href = "scripts/set_session.php?id="+split[2];
								
							}
							else if(split[1] == 2){
								verification(split[2]);
							
							}
							else{
							
								if(confirm("Your account have been block please contact the Basci Autosales Admin")){
									localtion.reload();
								}
							}
								
								
						}
						else{
							alert("Username doesnt exist or wrong password");
							//$("#msgbox").html(data);
						}
					}	
				});
			}
		}
		</script>
</head>

<body> <div id=" msgbox"></div>
<div id="msgbox"></div>


<div id="templatemo_wrapper">

	<div >
		<fieldset id="login">
		<legend id="potangina" >Admin Panel</legend>
		
		<table id="place" >
		<tr id="gago">
			<td><label >USERNAME:</label></td>
			<td>
			<input type="text" id="username" class="inputtype"/>
			</td>
		</tr>
		<tr id="gago">
			<td id="gago"><label id="gago">PASSWORD:</label></td>
			<td>
				<input type="password" id="password" class="inputtype"/>
			</td>
		</tr>
		<tr id="gago" >
			<td id="gago" colspan="2"><button id="enter">Login</button></td>
		
		</tr>
		
		
		</table>
		
		
		
		
		
		
		</fieldset>
	
	
	</div>



    
</div> <!-- END of templatemo_wrapper -->

</body>
</html>